import com.sweet.logging.storage.entity.LogMessage;
import com.sweet.logging.storage.store.SimpleFileStorageService;
import org.junit.Before;
import org.junit.Test;

import javax.naming.ConfigurationException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * <h1></h1>
 * <p>
 * <b>描述：</b>
 * <br>
 * <br>
 * </p>
 *
 * @author xiexiaofeng
 * @version 1.0     2017年09月12日  00点18分
 */
public class WriteSpeed
{
    List<LogMessage> messages = new ArrayList<>(100);

    @Before
    public void test()
    {
        LogMessage message = new LogMessage();
        message.setMessage("hahhahaaaaaaaaahahhfdahfa");
        message.setName(WriteSpeed.class.getName());
        message.setLevel("INFO");
        message.setTimeStamp(Long.MAX_VALUE);
        message.setClient("127.0.0.1");
        for (int i = 0; i < 100; i++)
        {
            messages.add(message);
        }
    }

    @Test
    public void run() throws IOException, ConfigurationException, InterruptedException
    {
        SimpleFileStorageService  service = new SimpleFileStorageService("E:\\sweet_logs\\");
        for (int i = 0; i < 1000000; i++)
        {
            //service.save(messages);
            Thread.sleep(1);
        }
    }

    @Test
    public void hash()
    {
        System.out.println(" hi trevor, i like you, this the 0 times i say it".hashCode());
    }
}
